function add0(m) {
  return m < 10 ? "0" + m : m;
}

export default {
  format: function(date, f = " ") {
    // let time = new Date(Number(Math.abs(date.split(/[()]/)[1])));
    let timer = date.split(/[T.]/);
    return timer[0] + f + timer[1];
  },
  formatStamp: function(date, f = "/") {
    // let time = new Date(Number(Math.abs(date.split(/[()]/)[1])));
    let time = new Date(Number(date.split(/[/Date()]/).join("")));
    let y = time.getFullYear();
    let m = time.getMonth() + 1;
    let d = time.getDate();
    let h = time.getHours();
    let mm = time.getMinutes();
    let s = time.getSeconds();
    date = y + f + add0(m) + f + add0(d) + " " + add0(h) + ":" + add0(mm) + ":" + add0(s);
    return date;
  },
};
